﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	public $title;
	public $price;
	public $images;
	public $name;
	public $goodsid;
	public $number;
	public $endtime;
	public $numbers;

	function __construct($title,$price,$images,$name,$goodsid,$number,$endtime,$numbers)
	{
		$this->title      = $title;
		$this->price = $price;
		$this->images     = $images;
		$this->name      = $name;
		$this->goodsid    = $goodsid;
		$this->number    = $number;
		$this->endtime   = $endtime;
		$this->numbers    = $numbers;
	}
}


if($_POST['page']!="")
{
$de=$_POST['page']*6;
}
else
{
$de=0;
}


	$state=1;

	$prize = array();
	  
		$rert30=mysql_query("select *from mycoupon where userid='".$_REQUEST[userid]."'order by couponid desc limit $de,6");

	while($rowf=mysql_fetch_array($rert30)){
	
	 $rert31=mysql_query("select *from coupon where couponid ='".$rowf[couponid]."' ");
$rowf1=mysql_fetch_array($rert31);

 $rert32=mysql_query("select *from shop where  shopid ='".$rowf[shopid]."'");
$rowf2=mysql_fetch_array($rert32);
			

			$prize[] = new MyPrizeBean($rowf1['title'],$rowf1['price'],$rowf1['images'],$rowf2['name'],$rowf['ordersid'],$rowf1['number'],$rowf1['endtime'],$rowf1['numbers']);
		
	}

echo json_encode($prize);


?>